package com.metagurukul.informer.service;

import java.sql.Connection;
import java.sql.PreparedStatement;
import com.metagurukul.informer.utility.ConnectionFactory;

import junit.framework.TestCase;

public class RegisterUserServiceTest extends TestCase {

	public void testDoRegisterUser(){
		
		try{
			RegisterUserService registerUserService=new RegisterUserService("test@metagurukul.com", "testUser");
			String password=registerUserService.doRegisterUser();
			assertNotNull(password);
		} catch (Exception ex) {
			assertNull(ex);
		}	
	}
	@Override
	protected void tearDown() throws Exception {
		try {
			Connection con=ConnectionFactory.getInstance();
			String sql = "DELETE FROM tempusers WHERE id=?";
			PreparedStatement ps = null;
			ps = con.prepareStatement(sql);
			ps.setString(1,"test@metagurukul.com");
			ps.executeUpdate();
		} catch (Exception ex) {
			assertNull(ex);
		}
	}
	/*public void testIsUserExists(){
		try{
			RegisterUserService registerUserService=new RegisterUserService("test@metagurukul.com", "testUser");
			boolean flag=registerUserService.isUserExist();
			assertEquals(true, flag);
		} catch (Exception ex) {
			assertNull(ex);
		}	
	}*/
	
}
